//
//  MenuScreen.m
//  iSudoku
//
//  Created by Tri Vo on 5/18/13.
//  Copyright (c) 2013 Tri Vo. All rights reserved.
//

#import "MenuScreen.h"
#import "SettingsScreen.h"
#import "LevelScreen.h"
#import "CreditScreen.h"
#import "GameUtils.h"
#import "HighScoresScreen.h"
#import "CCBReader.h"

@implementation MenuScreen

#pragma mark - Screen Life Cycle Methods

+ (id) scene {
    CCScene *scene = [CCScene node];
    MenuScreen *menuScreen = [MenuScreen node];
    [scene addChild:menuScreen];
    return scene;
}

- (id)init {
    self = [super init];
    if (self) {
        // Do something here
        
    }
    return self;
}

- (void)dealloc {
    [super dealloc];
}

#pragma mark - Screen Methods

- (void)onEnter {
    NSString *keyValue = [[GameUtils getInstance] getValueForKey:@"Game_Title"];
    [m_lblTitle setString:keyValue];
    
    // Start game
    keyValue = [[GameUtils getInstance] getValueForKey:@"Game_Start"];
    [m_btnStartGame setTitle:keyValue forState:CCControlStateNormal];
    
    // Solve
    keyValue = [[GameUtils getInstance] getValueForKey:@"Game_SolveSudoku"];
    [m_btnSolveSudoku setTitle:keyValue forState:CCControlStateNormal];
    
    // High Scores
    keyValue = [[GameUtils getInstance] getValueForKey:@"Game_HighScores"];
    [m_btnHighScores setTitle:keyValue forState:CCControlStateNormal];
    
    // Settings
    keyValue = [[GameUtils getInstance] getValueForKey:@"Game_Settings"];
    [m_btnSettings setTitle:keyValue forState:CCControlStateNormal];
    
    // About
    keyValue = [[GameUtils getInstance] getValueForKey:@"Game_About"];
    [m_btnAbout setTitle:keyValue forState:CCControlStateNormal];
    
}

#pragma mark - Screen button event

- (void) btnStart_Clicked:(id)sender {
    CCScene *scene = [CCBReader sceneWithNodeGraphFromFile:@"ChooseGameModeScreen.ccbi"];
    [[CCDirector sharedDirector] pushScene:[CCTransitionSlideInR transitionWithDuration:0.5f scene:scene]];
}

- (void) btnSetting_Clicked:(id)sender {
    CCScene *scene = [CCBReader sceneWithNodeGraphFromFile:@"SettingsScreen.ccbi"];
    [[CCDirector sharedDirector] pushScene:[CCTransitionSlideInR transitionWithDuration:0.5f scene:scene]];
}

- (void) btnSolve_Clicked:(id)sender {
    CCScene *scene = [CCBReader sceneWithNodeGraphFromFile:@"GameScreen.ccbi"];
    [[CCDirector sharedDirector] pushScene:[CCTransitionSlideInR transitionWithDuration:0.5f scene:scene]];
}

- (void) btnAbout_Clicked:(id)sender {
    CCScene *scene = [CCBReader sceneWithNodeGraphFromFile:@"CreditScreen.ccbi"];
    [[CCDirector sharedDirector] pushScene:[CCTransitionSlideInR transitionWithDuration:0.5f scene:scene]];
}

- (void) btnHighScores_Clicked:(id)sender {
    CCScene *scene = [CCBReader sceneWithNodeGraphFromFile:@"HighScoresScreen.ccbi"];
    [[CCDirector sharedDirector] pushScene:[CCTransitionSlideInR transitionWithDuration:0.5f scene:scene]];
}



@end
